package cn.edu.nwsuaf.teachercenter.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * StudentExerciceRecord entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "student_exercice_record", catalog = "exam")
public class StudentExerciceRecord implements java.io.Serializable {

	// Fields

	private StudentExerciceRecordId id;
	private Student student;
	private ExerciceItem exerciceItem;
	private Integer iscorrect;
	private String exerciceDate;

	// Constructors

	/** default constructor */
	public StudentExerciceRecord() {
	}

	/** full constructor */
	public StudentExerciceRecord(StudentExerciceRecordId id, Student student,
			ExerciceItem exerciceItem, Integer iscorrect, String exerciceDate) {
		this.id = id;
		this.student = student;
		this.exerciceItem = exerciceItem;
		this.iscorrect = iscorrect;
		this.exerciceDate = exerciceDate;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "studentNo", column = @Column(name = "student_no", nullable = false, length = 50)),
			@AttributeOverride(name = "itemNo", column = @Column(name = "item_no", nullable = false, length = 50)) })
	public StudentExerciceRecordId getId() {
		return this.id;
	}

	public void setId(StudentExerciceRecordId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "student_no", nullable = false, insertable = false, updatable = false)
	public Student getStudent() {
		return this.student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "item_no", nullable = false, insertable = false, updatable = false)
	public ExerciceItem getExerciceItem() {
		return this.exerciceItem;
	}

	public void setExerciceItem(ExerciceItem exerciceItem) {
		this.exerciceItem = exerciceItem;
	}

	@Column(name = "iscorrect", nullable = false)
	public Integer getIscorrect() {
		return this.iscorrect;
	}

	public void setIscorrect(Integer iscorrect) {
		this.iscorrect = iscorrect;
	}

	@Column(name = "exercice_date", nullable = false, length = 50)
	public String getExerciceDate() {
		return this.exerciceDate;
	}

	public void setExerciceDate(String exerciceDate) {
		this.exerciceDate = exerciceDate;
	}

}